package cn.fanyamin.business;

import java.util.List;

import cn.fanyamin.domain.Account;
import cn.fanyamin.domain.Article;
import cn.fanyamin.domain.Friend;
import cn.fanyamin.domain.Issue;
import cn.fanyamin.domain.Site;



public class ToolServiceImpl implements ToolService {

    private ICRUD<Integer, Account> accountDao;
    
    private ICRUD<Integer, Friend> friendDao;
    
    private ICRUD<Integer, Article> articleDao;
    
    private ICRUD<Integer, Issue> issueDao;
    
    private ICRUD<Integer, Site> siteDao;
    
    
    public int createAccount(Account account) {
        
        return accountDao.create(account);
    }

    public int createArticle(Article article) {
        
        return articleDao.create(article);
    }

    public int createFriend(Friend friend) {
        
        return friendDao.create(friend);
    }

    public int createIssue(Issue issue) {
        
        return issueDao.create(issue);
    }

    public int createSite(Site site) {
        
        return siteDao.create(site);
    }

    public int deleteAccount(int id) {
        
        return accountDao.delete(id);
    }

    public int deleteArticle(int id) {
        
        return articleDao.delete(id);
    }

    public int deleteFriend(int id) {
        
        return friendDao.delete(id);
    }

    public int deleteIssue(int id) {
        
        return issueDao.delete(id);
    }

    public int deleteSite(int id) {
        
        return siteDao.delete(id);
    }

    public List<Account> listAccount(int userID) {
        
        return accountDao.list(userID);
    }

    public List<Article> listArticle(int userID) {
        
        return articleDao.list(userID);
    }

    public List<Friend> listFriend(int userID) {
        
        return friendDao.list(userID);
    }

    public List<Issue> listIssue(int userID) {
        
        return issueDao.list(userID);
    }

    public List<Site> listSite(int userID) {
        
        return siteDao.list(userID);
    }

    public Account retrieveAccount(int id) {
        
        return accountDao.retrieve(id);
    }

    public Article retrieveArticle(int id) {
        
        return articleDao.retrieve(id);
    }

    public Friend retrieveFriend(int id) {
        
        return friendDao.retrieve(id);
    }

    public Issue retrieveIssue(int id) {
        
        return null;
    }

    public Site retrieveSite(int id) {
        
        return siteDao.retrieve(id);
    }

    public int updateAccount(Account t) {
        
        return accountDao.update(t);
    }

    public int updateArticle(Article t) {
        
        return articleDao.update(t);
    }

    public int updateFriend(Friend t) {
        
        return friendDao.update(t);
    }

    public int updateIssue(Issue t) {
        
        return issueDao.update(t);
    }

    public int updateSite(Site t) {
        
        return siteDao.update(t);
    }

    
    /**
     * @return the accountDao
     */
    public ICRUD<Integer, Account> getAccountDao() {
        return accountDao;
    }

    
    /**
     * @param accountDao the accountDao to set
     */
    public void setAccountDao(ICRUD<Integer, Account> accountDao) {
        this.accountDao = accountDao;
    }

   
    /**
     * @param friendDao the friendDao to set
     */
    public void setFriendDao(ICRUD<Integer, Friend> friendDao) {
        this.friendDao = friendDao;
    }


    /**
     * @param articleDao the articleDao to set
     */
    public void setArticleDao(ICRUD<Integer, Article> articleDao) {
        this.articleDao = articleDao;
    }

    
    /**
     * @param issueDao the issueDao to set
     */
    public void setIssueDao(ICRUD<Integer, Issue> issueDao) {
        this.issueDao = issueDao;
    }

    
   
    /**
     * @param siteDao the siteDao to set
     */
    public void setSiteDao(ICRUD<Integer, Site> siteDao) {
        this.siteDao = siteDao;
    }

    public List<Article> findArticle(Article article) {
        return articleDao.find(article);
    }

}
